#include <stdio.h>
long factorial(int x);
int main(int argc, char const *argv[])//声明，调用缺一不可
{
	int s;
	printf("Enter a positive integer:\n");
	scanf("%d",&s);
    if(s<=0)
    {
        printf("这个数字不合法\n");
    }
	factorial(s);
	printf("%d! is %d\n",s,factorial(s));
	return 0;
}
long factorial(int x)
{
	
	if (x == 0 )
	{
		return 1;
	}
	else 				
		return x*factorial(x-1);
}